<?php

use kartik\tree\TreeView;
use kartik\tree\TreeViewInput;
use common\models\db\TestTree;

/* @var $this yii\web\View */

$this->title = Yii::t('app', 'Menu');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="test-tree-index">

    <?php
    echo TreeView::widget([
        // single query fetch to render the tree
        'query'             => TestTree::find()->addOrderBy('root, lft'),
        'headingOptions'    => ['label' => '菜单管理'],
        'rootOptions' => ['label'=>'<span class="text-primary">根</span>'],
        'topRootAsHeading' => true, // this will override the headingOptions
//        'fontAwesome' => true,
//        'displayValue'      => 1,                           // initial display value
//        'fontAwesome' => false,     // optional
        'isAdmin' => Yii::$app->user->identity->is_super?true:true,         // optional (toggle to enable admin mode)
        'softDelete' => true,       // defaults to true
        'cacheSettings' => [
            'enableCache' => true   // defaults to true
        ],
        'nodeView' => '@admin/modules/test/views/test-tree/_form_tree',
        'nodeAddlViews' => [
            \kartik\tree\Module::VIEW_PART_2 => '@admin/modules/test/views/test-tree/_tree_2',
        ],
    ]);
    ?>
</div>
